<?php
/* 
 * ********* CVS HEADER ********* 
 * 
 * $RCSfile: admplugliste.php,v $ 
 * $Date: 2005/10/05 15:22:58 $ 
 * $Revision: 1.3 $ 
 * 
 * ********* CVS HEADER ********* 
 */
require_once("module/TPLN/TPLN.php");
require_once("module/INI/readinifile.php");
$TPLN = new TPLN;
$TPLN->Open($op_basepath."tpl/admplugliste.html");
require_once(get_path_module("admin")); 
$pc = new panneau_controle(); 
$pc->calculRubriqueParFonction($op); 
$TPLN->Parse("panneau_controle",$pc->retourneEntete());

$handle=opendir("plugins");
$i = 0;
$class = "liste_impaire";
while($rep=readdir($handle)) {
	if(($rep!=".")&&($rep!=".."))
	{
		if(is_dir("plugins/$rep"))
		{
			$query="SELECT * FROM rportal_installation WHERE directory='$rep'";
			$result=rportalrequete($query) or rportalerreur($query,"?op=");
			if(rportalnbresult($result)!=1){
				$fichier = "plugins/$rep/param/plugin.ini";
				if(file_exists($fichier)){
					$i=1;
					$plugparams = new readinifile();
					$plugparams->readfile("plugins/$rep/param/plugin.ini");
				    $TPLN->Parse("liste.pid","-");
					$TPLN->Parse("liste.nom",$plugparams->get_value("INSTALL","plugin.nom"));
					$TPLN->Parse("liste.date","-");
					$TPLN->Parse("liste.repertoire",$rep);
					$TPLN->Parse("liste.install.rep",$rep);
					$TPLN->Parse("liste.classe",$class);
			        if($class!="liste_impaire") 
			        { 
			            $class="liste_impaire"; 
			        }else{ 
			            $class="liste_paire"; 
			        } 
					$TPLN->Loop("liste");
				}
			}else{
				$i=1;
				$inst=rportalligne($result);
				$TPLN->Parse("liste.pid",$inst['id']);
				$TPLN->Parse("liste.nom",$inst['titre']);
				$TPLN->Parse("liste.date",$inst['date']);
				$TPLN->Parse("liste.repertoire",$rep);
				$TPLN->ParseBloc("liste.install","-");
				$TPLN->Parse("liste.classe",$class);
		        if($class!="liste_impaire") 
		        { 
		            $class="liste_impaire"; 
		        }else{ 
		            $class="liste_paire"; 
		        } 
				$TPLN->Loop("liste");
			}
		}
	}
}
if($i==0){
	$TPLN->EraseBloc("liste");
}
$TPLN->IncludeFile("header","environnement/".$session['environnement']."/header.php");
$TPLN->IncludeFile("footer","environnement/".$session['environnement']."/footer.php");
$TPLN->Write();
?>